package 尚硅谷juc大厂.test7;

public class Test7 {

    /**
     * 非公平锁：使用非公平锁容易出现锁饥饿问题
     */
    public static void main(String[] args) {
        Ticket ticket=new Ticket();
        /**
         *5个售票窗口，同步执行卖票
         */
        new Thread(()->{for (int i=0;i<55;i++){ticket.sale();}},"AA").start();
        new Thread(()->{for (int i=0;i<55;i++){ticket.sale();}},"BB").start();
        new Thread(()->{for (int i=0;i<55;i++){ticket.sale();}},"CC").start();
        new Thread(()->{for (int i=0;i<55;i++){ticket.sale();}},"DD").start();
        new Thread(()->{for (int i=0;i<55;i++){ticket.sale();}},"EE").start();

    }
}
